
import java.io.*;
import java.sql.*;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFFooter;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author admin
 */
public class Test {

    public static  void main(String a[]) throws FileNotFoundException, IOException{

try{
        HSSFWorkbook hwb = new HSSFWorkbook();
 HSSFSheet sheet = hwb.createSheet("new sheet");
 HSSFFooter footer = sheet.getFooter();
 footer.setRight( "Page " + HSSFFooter.page()
+ " of " + HSSFFooter.numPages() );
 for(int i=0;i<20;i++)
 {
  HSSFRow row = sheet.createRow((short) 1+i);
  HSSFCell cell = row.createCell((short) 1);
  cell.setCellValue("rajesh");
  }
 FileOutputStream fileOut = new FileOutputStream
("D:\\footerExcel.xls");
  hwb.write(fileOut);
  fileOut.close();
   
  } catch ( Exception ex ) {
 }



    }

}
